<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>动画</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      h1 {
        background-color: orange;
      }
      @keyframes atguigu {
        from {
          transform: translateX(0);
        }
        to {
          transform: translateX(-100%);
        }
      }
      .go {
        animation: atguigu 1s linear;
        animation-fill-mode: forwards;
      }
      .come {
        animation: atguigu 1s linear reverse;
        animation-fill-mode: forwards;
      }
    </style>
  </head>
  <body>
    <h1>你好啊</h1>
  </body>
</html>